/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package paquete1;

/**
 *
 * @author Administrador
 */
public class Calc {
    public void ordenaArray(int[] x) {//go through the array and sort from smallest to highest
      int n = x.length;
      //añado comentario1
      for(int i=0; i<n; i++) {
          for (int j=1; j<(n-i); j++) {
            int temp=0;
            if(x[j-1] > x[j]) {
                temp = x[j-1];
                x[j-1] = x[j];
                x[j] = temp;
            }
        }
      }   
   }

    
    
    private double calculaMedia(double a, double b) {
        return(a+b)/2;
    }
    
    public double media (double a,double b) {
           double resultado=0.0;
           if (a<0 || b<0)
                return -1;
            else
               resultado=calculaMedia(a,b);
               resultado=calculaMedia(a,b);
               return(resultado);
   }
        
    
    public double sum (double a, double b) {
       if (a>0 && b>0) 
            return a+b;
       else
           return -1;
}   
    public double minus (double a, double b) {
        if (a>0 && b>0)
            return a-b;
        else
            return -1;    
            
}
}
